<template>
	<view class="content" v-bind:style="{height:phoneHeight+'px'}">
		<view class="expertAppointTitle">添加会话</view>
		<view class="ChiefComplaint">
			<view class="expertAppointBox">
				<view class="expertAppointItemTitle">顾客编号</view>
				<view class="expertAppointItemDetail">
					<input placeholder-style="color:#999999" disabled v-model="mess.memberCode" placeholder="请输入顾客编号" />
				</view>
			</view>
			<view class="expertAppointBox">
				<view class="expertAppointItemTitle">标题</view>
				<view class="expertAppointItemDetail">
					<input placeholder-style="color:#999999" v-model="mess.title" placeholder="请输入标题。" />
				</view>
			</view>
			<view class="expertAppointBox">
				<view class="expertAppointItemTitle">留言内容</view>
				<view class="expertAppointItemDetail">
					<textarea placeholder-style="color:#999999" v-model="mess.content" placeholder="请填写您想要的留言。" />
				</view>
			</view>
			<view class="submitButton" @click="addMsgFunc">提交</view>
		</view>
	</view>
</template>

<script>
	import {
		getMessageAddSubmit
	} from '@/api/directSelling.js'
	export default {
		data() {
			return {
				phoneHeight: 0,
				reportList: [],
				mess: {
					memberCode: "",
					title: "",
					content: ""
				}
			}
		},
		onLoad() {
			this.mess.memberCode = uni.getStorageSync('userInfo').memberCode;

		},
		onReady() {
			// 计算屏幕剩余高度  填补剩余高度
			let _this = this;
			uni.getSystemInfo({
				success(res) {
					_this.phoneHeight = res.windowHeight;
				}
			});
		},
		methods: {
			addMsgFunc() {
				if (this.mess.title == "") {
					this.$util.Tips({
						title: '请填写标题！'
					})
					return false;
				}
				if (this.mess.content == "") {
					this.$util.Tips({
						title: '请填写内容！'
					})
					return false;
				}
				getMessageAddSubmit(this.mess).then((res) => {
					if (res.meta.success == true) {
						console.log("判断陈工");
						this.$util.Tips({
							title: '添加成功！'
						})
						setTimeout(()=>{
							uni.navigateTo({
								url: "/pages/zx_users/serviceMsg/list"
							});
						},500)
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 0 50rpx;
		box-sizing: border-box;
		//background: linear-gradient(0deg, #FFFFFF 34%, #c3d9e5 100%);

		.expertAppointTitle {
			line-height: 144rpx;
			color: #333333;
			font-size: 60rpx;
			font-weight: bold;
		}

		.ChiefComplaint {
			color: #333333;
			font-size: 30rpx;
			text-align: center;
		}

		.expertAppointBox {
			margin-bottom: 22rpx;
			text-align: left;

			.expertAppointItemTitle {
				height: 91rpx;
				line-height: 91rpx;
			}

			.expertAppointItemDetail {
				border: 0.5px solid #999999;
				border-radius: 10rpx;
				padding: 32rpx 25rpx;
				box-sizing: border-box;
				text-align: left;

				uni-textarea {
					width: 100%;
					height: 100%;
					height: 190rpx;
					font-size: 30rpx;
				}

				.addPicture {
					width: 148rpx;
					height: 148rpx;
					background: #F8F8F8;
					color: #999999;
					font-size: 24rpx;
					text-align: center;

					uni-image {
						width: 44rpx;
						height: 44rpx;
						margin: 23rpx 0 10rpx 0;
					}
				}

				.reportBox {
					height: 60rpx;
					line-height: 60rpx;

					>view {
						display: inline-block;
						vertical-align: middle;
						height: 100%;
					}

					.reportUrl {
						width: calc(100% - 60rpx);
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.reportDel {
						width: 60rpx;
						text-align: center;
						font-size: 60rpx;
					}
				}
			}
		}

		.submitButton {
			width: 100%;
			height: 80rpx;
			display: inline-block;
			line-height: 80rpx;
			text-align: center;
			background: $theme-color;
			border-radius: 40rpx;
			font-size: 30rpx;
			color: #fff;
			margin-top:40rpx;
		}
	}
</style>
